home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 23 / Amiga Format AFCD23 (Feb 1998, Issue 107).iso / +look_here_1st!+ / reader_requests / alienbreed3d2 / cheesesauce / newplayershoot.s < prev    next >
Text File  |  1997-11-28  |  17KB  |  1,094 lines

  1.  
  2. PLR1_clicked: dc.b 0
  3. PLR2_clicked: dc.b 0
  4. popping: ds.l 5*4
  5. targdist: dc.w 0
  6. targetydiff: dc.l 0
  7. PLR1_TimeToShoot: dc.w 0
  8. PLR2_TimeToShoot: dc.w 0
  9.  
  10. MaxFrame: dc.w 0
  11. BULTYPE: dc.w 0
  12. AmmoInMyGun: dc.w 0
  13.  
  14. Player1Shot:
  15.  
  16.  tst.w PLR1_TimeToShoot
  17.  beq.s okcanfire
  18.  
  19.  move.w TempFrames,d0
  20.  sub.w d0,PLR1_TimeToShoot
  21.  bge PLR1_nofire
  22.  move.w #0,PLR1_TimeToShoot
  23.  bra PLR1_nofire
  24.  
  25. okcanfire:
  26.  
  27.  moveq #0,d0
  28.  move.b p1_gunselected,d0
  29.  move.b d0,tempgun
  30.  
  31.  
  32.  move.l LINKFILE,a6
  33.  lea GunBulletTypes(a6),a6
  34.  lea BulletAnimData-GunBulletTypes(a6),a5
  35.  lea (a6,d0.w*8),a6
  36.  move.w G_BulletType(a6),d0 ; bullet type
  37.  move.w d0,BULTYPE
  38.  move.l #PLAYERONEAMMO,a0
  39.  move.w (a0,d0.w*2),AmmoInMyGun
  40.  
  41.  muls #B_BulStatLen,d0
  42.  add.w d0,a5
  43.  
  44.  move.w B_MovementSpeed+2(a5),BulletSpd
  45.  
  46. ; tst.w (a6)
  47. ; beq.s .itsaclick
  48.  
  49.  tst.b p1_fire
  50.  beq PLR1_nofire
  51. ; bra .itsahold
  52. ;
  53. ;.itsaclick:
  54. ; tst.b p1_clicked
  55. ; beq PLR1_nofire
  56. ;
  57. ;.itsahold:
  58.  
  59.  move.w PLR1_angpos,d0
  60.  move.l #SineTable,a0
  61.  lea (a0,d0.w),a0
  62.  move.w (a0),tempxdir 
  63.  move.w 2048(a0),tempzdir
  64.  move.w PLR1_xoff,tempxoff
  65.  move.w PLR1_zoff,tempzoff
  66.  move.l PLR1_yoff,tempyoff
  67.  add.l #20*128,tempyoff
  68.  move.b PLR1_StoodInTop,tempStoodInTop
  69.  move.l PLR1_Roompt,tempRoompt
  70.  move.l #%100011,d7
  71.  move.w #-1,d0
  72.  move.l #0,targetydiff
  73.  move.l #$7fff,d1
  74.  
  75.  move.l ZoneAdds,a3
  76.  
  77.  move.l #PLR1_ObsInLine,a1
  78.  move.l ObjectData,a0
  79.  move.l #PLR1_ObjDists,a2
  80. findclosestinline
  81.  
  82.  tst.w (a0)
  83.  blt outofline
  84.  
  85.  cmp.b #3,16(a0)
  86.  beq notlinedup
  87.  
  88.  tst.b (a1)+
  89.  beq.s notlinedup
  90.  btst #0,17(a0)
  91.  beq.s notlinedup
  92.  tst.w 12(a0)
  93.  blt.s notlinedup
  94.  move.b 16(a0),d6
  95.  btst d6,d7
  96.  beq.s notlinedup
  97.  
  98.  tst.b numlives(a0)
  99.  beq.s notlinedup
  100.  move.w (a0),d5
  101.  move.w (a2,d5.w*2),d6
  102.  move.w 4(a0),d2
  103.  ext.l d2
  104.  asl.l #7,d2
  105.  sub.l PLR1_yoff,d2
  106.  move.l d2,d3
  107.  bge.s .oknotneg
  108.  neg.l d2
  109. .oknotneg:
  110.  divs #44,d2
  111.  cmp.w d6,d2
  112.  bgt.s notlinedup
  113.  
  114.  cmp.w d6,d1
  115.  blt.s notlinedup
  116.  move.w d6,d1
  117.  move.l a0,a4
  118.  
  119. ; We have a closer enemy lined up.
  120.  move.l d3,targetydiff 
  121.  move.w d5,d0
  122.  
  123. notlinedup:
  124.  add.w #64,a0
  125.  bra findclosestinline
  126.  
  127. outofline:
  128.  
  129.  
  130.  move.w d1,targdist
  131.  
  132.  move.l targetydiff,d5
  133.  sub.l PLR1_height,d5
  134.  add.l #18*256,d5
  135.  move.w d1,closedist
  136.  
  137.  move.w BulletSpd,d2
  138.  asr.w d2,d1
  139.  tst.w d1
  140.  bgt.s okdistthing
  141.  moveq #1,d1
  142. okdistthing
  143.  divs d1,d5
  144.  move.w d5,bulyspd
  145.  
  146.  move.w AmmoInMyGun,d2
  147.  move.w G_BulletsPerShot(a6),d1
  148.  cmp.w d1,d2
  149.  bge.s .okcanshoot
  150.  
  151.  move.l PLR1_Obj,a2
  152.  move.w (a2),d0
  153.  move.l #ObjRotated,a2
  154.  move.l (a2,d0.w*8),Noisex
  155.  move.w #300,Noisevol
  156.  move.w #100,PLAYERONENOISEVOL
  157.  move.w #12,Samplenum
  158.  clr.b notifplaying
  159.  move.b #$fb,IDNUM
  160.  jsr MakeSomeNoise
  161.  
  162.  rts
  163.  
  164. .okcanshoot:
  165.  
  166.  cmp.b #'s',mors
  167.  beq.s .notplr1
  168.  move.l PLR1_Obj,a2
  169.  move.w #1,ObjTimer+128(a2)
  170. .notplr1
  171.  
  172.  move.w G_DelayBetweenShots(a6),PLR1_TimeToShoot
  173.  
  174.  move.b MaxFrame,PLR1_GunFrame
  175.  sub.w d1,d2
  176.  
  177.  move.l #PLAYERONEAMMO,a2
  178.  add.w BULTYPE,a2
  179.  add.w BULTYPE,a2
  180.  move.w d2,(a2)
  181.  
  182.  move.l PLR1_Obj,a2
  183.  move.w (a2),d2
  184.  move.l #ObjRotated,a2
  185.  move.l (a2,d2.w*8),Noisex
  186.  move.w #100,PLAYERONENOISEVOL
  187.  move.w #300,Noisevol
  188.  move.w G_SoundEffect(a6),Samplenum
  189.  move.b #2,chanpick
  190.  clr.b notifplaying
  191.  movem.l d0/a0/d5/d6/d7/a6/a4/a5,-(a7)
  192.  move.b #$fb,IDNUM
  193.  jsr MakeSomeNoise
  194.  movem.l (a7)+,d0/a0/d5/d6/d7/a6/a4/a5
  195.  
  196.  tst.w d0
  197.  blt nothingtoshoot
  198.  
  199.  tst.l B_Gravity(a5)
  200.  beq.s .notuseaim
  201.  move.w PLR1_AIMSPD,d2
  202.  move.w #8,d1
  203.  sub.w BulletSpd,d1
  204.  asr.w d1,d2
  205.  move.w d2,bulyspd
  206. .notuseaim
  207.  
  208.  tst.w B_VisibleOrInstant+2(a5)
  209.  beq PLR1FIREBULLET
  210.  
  211. ; instant effect: check for hitting:
  212.  
  213.  move.w G_BulletsPerShot(a6),d7
  214.  
  215. FIREBULLETS:
  216.  
  217.  movem.l a0/a1/d7/d0/a4/a5,-(a7)
  218.  jsr GetRand
  219.  
  220.  move.l ObjectPoints,a1
  221.  move.w (a4),d1
  222.  lea (a1,d1.w*8),a1
  223.  
  224.  and.w #$7fff,d0
  225.  move.w (a1),d1
  226.  sub.w PLR1_xoff,d1
  227.  muls d1,d1
  228.  move.w 4(a1),d2
  229.  sub.w PLR1_zoff,d2
  230.  muls d2,d2
  231.  add.l d2,d1
  232.  asr.l #6,d1
  233.  ext.l d0
  234.  asl.l #1,d0
  235.  cmp.l d1,d0
  236.  bgt.s .hitplr
  237.  
  238.  movem.l (a7)+,a0/a1/d7/d0/a5/a4
  239.  move.l d0,-(a7)
  240.  bsr PLR1MISSINSTANT
  241.  move.l (a7)+,d0
  242.  
  243.  bra.s .missplr
  244. .hitplr: 
  245.  
  246.  movem.l (a7)+,a0/a1/d7/d0/a5/a4
  247.  move.l d0,-(a7)
  248.  bsr PLR1HITINSTANT
  249.  move.l (a7)+,d0
  250.  
  251. .missplr:
  252.  
  253.  subq #1,d7
  254.  bgt.s FIREBULLETS
  255.  
  256.  rts
  257.  
  258. PLR1_AIMSPD: dc.l 0
  259.  
  260. nothingtoshoot:
  261.  move.w PLR1_AIMSPD,d0
  262.  move.w #8,d1
  263.  sub.w BulletSpd,d1
  264.  asr.w d1,d0
  265.  move.w d0,bulyspd
  266.  tst.w B_VisibleOrInstant+2(a5)
  267.  beq PLR1FIREBULLET
  268.  
  269.  move.w #0,bulyspd
  270.  
  271.  move.w PLR1_xoff,oldx
  272.  move.w PLR1_zoff,oldz
  273.  move.w PLR1_sinval,d0
  274.  asr.w #7,d0
  275.  add.w oldx,d0
  276.  move.w d0,newx
  277.  move.w PLR1_cosval,d0
  278.  asr.w #7,d0
  279.  add.w oldz,d0
  280.  move.w d0,newz
  281.  move.l PLR1_yoff,d0
  282.  add.l #20*128,d0
  283.  move.l d0,oldy
  284.  
  285.  move.l d0,d1
  286.  jsr GetRand
  287.  and.w #$fff,d0
  288.  sub.w #$800,d0
  289.  ext.l d0
  290.  add.l d0,d1
  291.  
  292.  move.l d1,newy
  293.  
  294.  st exitfirst
  295.  clr.b wallbounce
  296.  move.w #0,extlen
  297.  move.b #$ff,awayfromwall
  298.  move.w #%0000010000000000,wallflags
  299.  move.l #0,StepUpVal
  300.  move.l #$1000000,StepDownVal
  301.  move.l #0,thingheight
  302.  move.l PLR1_Roompt,objroom
  303.  movem.l d0-d7/a0-a6,-(a7)
  304.  
  305. .again:
  306.  jsr MoveObject
  307.  tst.b hitwall
  308.  bne.s .nofurther
  309.  move.w newx,d0
  310.  sub.w oldx,d0
  311.  add.w d0,oldx
  312.  add.w d0,newx
  313.  move.w newz,d0
  314.  sub.w oldz,d0
  315.  add.w d0,oldz
  316.  add.w d0,newz
  317.  move.l newy,d0
  318.  sub.l oldy,d0
  319.  add.l d0,oldy
  320.  add.l d0,newy
  321.  bra .again
  322.  
  323. .nofurther:
  324.  
  325.  movem.l (a7)+,d0-d7/a0-a6
  326.  
  327.  move.l PlayerShotData,a0
  328.  move.w #19,d1
  329. .findonefree2
  330.  move.w 12(a0),d2
  331.  blt.s .foundonefree2
  332.  adda.w #64,a0
  333.  dbra d1,.findonefree2
  334.  
  335.  rts
  336.  
  337. .foundonefree2:
  338.  
  339.  move.l ObjectPoints,a1
  340.  move.w (a0),d2
  341.  move.w newx,(a1,d2.w*8)
  342.  move.w newz,4(a1,d2.w*8)
  343.  move.b #1,shotstatus(a0)
  344.  move.w #0,shotgrav(a0)
  345.  move.b BULTYPE+1,shotsize(a0)
  346.  move.b #0,shotanim(a0)
  347.  
  348.  move.l objroom,a1
  349.  move.w (a1),12(a0)
  350.  st worry(a0)
  351.  move.l wallhitheight,d0
  352.  move.l d0,accypos(a0)
  353.  asr.l #7,d0
  354.  move.w d0,4(a0)
  355.  
  356.  rts
  357.  
  358. PLR1_nofire:
  359.  
  360.  rts
  361.  
  362. TESTY: dc.l 0,0,0,0
  363.  
  364. Player2Shot:
  365.  
  366.  tst.w PLR2_TimeToShoot
  367.  beq.s okcanfire2
  368.  
  369.  move.w TempFrames,d0
  370.  sub.w d0,PLR2_TimeToShoot
  371.  bge PLR2_nofire
  372.  move.w #0,PLR2_TimeToShoot
  373.  bra PLR2_nofire
  374.  
  375. okcanfire2:
  376.  
  377.  moveq #0,d0
  378.  move.b p2_gunselected,d0
  379.  move.b d0,tempgun
  380.  
  381.  
  382.  move.l LINKFILE,a6
  383.  lea GunBulletTypes(a6),a6
  384.  lea BulletAnimData-GunBulletTypes(a6),a5
  385.  lea (a6,d0.w*8),a6
  386.  move.w G_BulletType(a6),d0 ; bullet type
  387.  move.w d0,BULTYPE
  388.  move.l #PLAYERTWOAMMO,a0
  389.  move.w (a0,d0.w*2),AmmoInMyGun
  390.  
  391.  muls #B_BulStatLen,d0
  392.  add.w d0,a5
  393.  
  394.  move.w B_MovementSpeed+2(a5),BulletSpd
  395.  
  396. ; tst.w 12(a6)
  397. ; beq.s .itsaclick
  398.  
  399.  tst.b p2_fire
  400.  beq PLR2_nofire
  401. ; bra .itsahold
  402. ;
  403. ;.itsaclick:
  404. ; tst.b p2_clicked
  405. ; beq PLR2_nofire
  406. ;
  407. ;.itsahold:
  408.  
  409.  move.w PLR2_angpos,d0
  410.  move.l #SineTable,a0
  411.  lea (a0,d0.w),a0
  412.  move.w (a0),tempxdir 
  413.  move.w 2048(a0),tempzdir
  414.  move.w PLR2_xoff,tempxoff
  415.  move.w PLR2_zoff,tempzoff
  416.  move.l PLR2_yoff,tempyoff
  417.  add.l #20*128,tempyoff
  418.  move.b PLR2_StoodInTop,tempStoodInTop
  419.  move.l PLR2_Roompt,tempRoompt
  420.  move.l #%10011,d7
  421.  move.w #-1,d0
  422.  move.l #0,targetydiff
  423.  move.l #$7fff,d1
  424.  
  425.  move.l ZoneAdds,a3
  426.  
  427.  move.l #PLR2_ObsInLine,a1
  428.  move.l ObjectData,a0
  429.  move.l #PLR2_ObjDists,a2
  430. findclosestinline2
  431.  
  432.  tst.w (a0)
  433.  blt outofline2
  434.  
  435.  cmp.b #3,16(a0)
  436.  beq notlinedup2
  437.  
  438.  tst.b (a1)+
  439.  beq.s notlinedup2
  440.  btst #1,17(a0)
  441.  beq.s notlinedup2
  442.  tst.w 12(a0)
  443.  blt.s notlinedup2
  444.  move.b 16(a0),d6
  445.  btst d6,d7
  446.  beq.s notlinedup2
  447.  
  448.  tst.b numlives(a0)
  449.  beq.s notlinedup2
  450.  move.w (a0),d5
  451.  move.w (a2,d5.w*2),d6
  452.  move.w 4(a0),d2
  453.  ext.l d2
  454.  asl.l #7,d2
  455.  sub.l PLR2_yoff,d2
  456.  move.l d2,d3
  457.  bge.s .oknotneg
  458.  neg.l d2
  459. .oknotneg:
  460.  divs #44,d2
  461.  cmp.w d6,d2
  462.  bgt.s notlinedup2
  463.  
  464.  cmp.w d6,d1
  465.  blt.s notlinedup2
  466.  move.w d6,d1
  467.  move.l a0,a4
  468.  
  469. ; We have a closer enemy lined up.
  470.  move.l d3,targetydiff 
  471.  move.w d5,d0
  472.  
  473. notlinedup2:
  474.  add.w #64,a0
  475.  bra findclosestinline2
  476.  
  477. outofline2:
  478.  
  479.  
  480.  move.w d1,targdist
  481.  
  482.  move.l targetydiff,d5
  483.  sub.l PLR2_height,d5
  484.  add.l #18*256,d5
  485.  move.w d1,closedist
  486.  
  487.  move.w BulletSpd,d2
  488.  asr.w d2,d1
  489.  tst.w d1
  490.  bgt.s okdistthing2
  491.  moveq #1,d1
  492. okdistthing2
  493.  divs d1,d5
  494.  move.w d5,bulyspd
  495.  
  496.  move.w AmmoInMyGun,d2
  497.  move.w G_BulletsPerShot(a6),d1
  498.  cmp.w d1,d2
  499.  bge.s .okcanshoot
  500.  
  501.  move.l PLR2_Obj,a2
  502.  move.w (a2),d0
  503.  move.l #ObjRotated,a2
  504.  move.l (a2,d0.w*8),Noisex
  505.  move.w #300,Noisevol
  506.  move.w #100,PLAYERTWONOISEVOL
  507.  move.w #12,Samplenum
  508.  clr.b notifplaying
  509.  move.b #$fb,IDNUM
  510.  jsr MakeSomeNoise
  511.  
  512.  rts
  513.  
  514. .okcanshoot:
  515.  
  516.  cmp.b #'s',mors
  517.  bne.s .notplr2
  518.  move.l PLR1_Obj,a2
  519.  move.w #1,ObjTimer+128(a2)
  520. .notplr2:
  521.  
  522.  move.w G_DelayBetweenShots(a6),PLR2_TimeToShoot
  523.  
  524.  move.b MaxFrame,PLR2_GunFrame
  525.  sub.w d1,d2
  526.  
  527.  move.l #PLAYERTWOAMMO,a2
  528.  add.w BULTYPE,a2
  529.  add.w BULTYPE,a2
  530.  move.w d2,(a2)
  531.  
  532.  move.l PLR2_Obj,a2
  533.  move.w (a2),d2
  534.  move.l #ObjRotated,a2
  535.  move.l (a2,d2.w*8),Noisex
  536.  move.w #100,PLAYERTWONOISEVOL
  537.  move.w #300,Noisevol
  538.  move.w G_SoundEffect(a6),Samplenum
  539.  move.b #2,chanpick
  540.  clr.b notifplaying
  541.  movem.l d0/a0/d5/d6/d7/a6/a4/a5,-(a7)
  542.  move.b #$fb,IDNUM
  543.  jsr MakeSomeNoise
  544.  movem.l (a7)+,d0/a0/d5/d6/d7/a6/a4/a5
  545.  
  546.  tst.w d0
  547.  blt nothingtoshoot2
  548.  
  549.  tst.l B_Gravity(a5)
  550.  beq.s .notuseaim
  551.  move.w PLR2_AIMSPD,d2
  552.  move.w #8,d1
  553.  sub.w BulletSpd,d1
  554.  asr.w d1,d2
  555.  move.w d2,bulyspd
  556. .notuseaim
  557.  
  558.  tst.w B_VisibleOrInstant+2(a5)
  559.  beq PLR2FIREBULLET
  560.  
  561. ; instant effect: check for hitting:
  562.  
  563.  move.w G_BulletsPerShot(a6),d7
  564.  
  565. FIREBULLETS2:
  566.  
  567.  movem.l a0/a1/d7/d0/a4/a5,-(a7)
  568.  jsr GetRand
  569.  
  570.  move.l ObjectPoints,a1
  571.  move.w (a4),d1
  572.  lea (a1,d1.w*8),a1
  573.  
  574.  and.w #$7fff,d0
  575.  move.w (a1),d1
  576.  sub.w PLR2_xoff,d1
  577.  muls d1,d1
  578.  move.w 4(a1),d2
  579.  sub.w PLR2_zoff,d2
  580.  muls d2,d2
  581.  add.l d2,d1
  582.  asr.l #6,d1
  583.  ext.l d0
  584.  asl.l #1,d0
  585.  cmp.l d1,d0
  586.  bgt.s .hitplr
  587.  
  588.  movem.l (a7)+,a0/a1/d7/d0/a5/a4
  589.  move.l d0,-(a7)
  590.  bsr PLR2MISSINSTANT
  591.  move.l (a7)+,d0
  592.  
  593.  bra.s .missplr
  594. .hitplr: 
  595.  
  596.  movem.l (a7)+,a0/a1/d7/d0/a5/a4
  597.  move.l d0,-(a7)
  598.  bsr PLR2HITINSTANT
  599.  move.l (a7)+,d0
  600.  
  601. .missplr:
  602.  
  603.  subq #1,d7
  604.  bgt.s FIREBULLETS2
  605.  
  606.  rts
  607.  
  608. PLR2_AIMSPD: dc.l 0
  609.  
  610. nothingtoshoot2:
  611.  move.w PLR2_AIMSPD,d0
  612.  move.w #8,d1
  613.  sub.w BulletSpd,d1
  614.  asr.w d1,d0
  615.  move.w d0,bulyspd
  616.  tst.w B_VisibleOrInstant+2(a5)
  617.  beq PLR2FIREBULLET
  618.  
  619.  move.w #0,bulyspd
  620.  
  621.  move.w PLR2_xoff,oldx
  622.  move.w PLR2_zoff,oldz
  623.  move.w PLR2_sinval,d0
  624.  asr.w #7,d0
  625.  add.w oldx,d0
  626.  move.w d0,newx
  627.  move.w PLR2_cosval,d0
  628.  asr.w #7,d0
  629.  add.w oldz,d0
  630.  move.w d0,newz
  631.  move.l PLR2_yoff,d0
  632.  add.l #20*128,d0
  633.  move.l d0,oldy
  634.  
  635.  move.l d0,d1
  636.  jsr GetRand
  637.  and.w #$fff,d0
  638.  sub.w #$800,d0
  639.  ext.l d0
  640.  add.l d0,d1
  641.  
  642.  move.l d1,newy
  643.  
  644.  st exitfirst
  645.  clr.b wallbounce
  646.  move.w #0,extlen
  647.  move.b #$ff,awayfromwall
  648.  move.w #%0000010000000000,wallflags
  649.  move.l #0,StepUpVal
  650.  move.l #$1000000,StepDownVal
  651.  move.l #0,thingheight
  652.  move.l PLR2_Roompt,objroom
  653.  movem.l d0-d7/a0-a6,-(a7)
  654.  
  655. .again:
  656.  jsr MoveObject
  657.  tst.b hitwall
  658.  bne.s .nofurther
  659.  move.w newx,d0
  660.  sub.w oldx,d0
  661.  add.w d0,oldx
  662.  add.w d0,newx
  663.  move.w newz,d0
  664.  sub.w oldz,d0
  665.  add.w d0,oldz
  666.  add.w d0,newz
  667.  move.l newy,d0
  668.  sub.l oldy,d0
  669.  add.l d0,oldy
  670.  add.l d0,newy
  671.  bra .again
  672.  
  673. .nofurther:
  674.  
  675.  movem.l (a7)+,d0-d7/a0-a6
  676.  
  677.  move.l PlayerShotData,a0
  678.  move.w #19,d1
  679. .findonefree2
  680.  move.w 12(a0),d2
  681.  blt.s .foundonefree2
  682.  adda.w #64,a0
  683.  dbra d1,.findonefree2
  684.  
  685.  rts
  686.  
  687. .foundonefree2:
  688.  
  689.  move.l ObjectPoints,a1
  690.  move.w (a0),d2
  691.  move.w newx,(a1,d2.w*8)
  692.  move.w newz,4(a1,d2.w*8)
  693.  move.b #1,shotstatus(a0)
  694.  move.w #0,shotgrav(a0)
  695.  move.b BULTYPE+1,shotsize(a0)
  696.  move.b #0,shotanim(a0)
  697.  
  698.  move.l objroom,a1
  699.  move.w (a1),12(a0)
  700.  st worry(a0)
  701.  move.l wallhitheight,d0
  702.  move.l d0,accypos(a0)
  703.  asr.l #7,d0
  704.  move.w d0,4(a0)
  705.  
  706.  rts
  707.  
  708. PLR2_nofire:
  709.  
  710.  rts
  711.  
  712.  
  713. BulletSpd: dc.w 0
  714.  
  715. *******************************************************
  716.  
  717. tempyoff: dc.l 0
  718. tempStoodInTop: dc.w 0
  719. tempangpos: dc.w 0
  720. tempxdir: dc.w 0
  721. tempzdir: dc.w 0
  722. tempgun: dc.w 0
  723. tstfire: dc.w 0
  724. PLR1FIREBULLET:
  725.  
  726.  move.w #256,d6
  727.  move.w #256,d5
  728.  
  729.  move.l #%100011,d7
  730.  
  731.  move.b MaxFrame,PLR1_GunFrame
  732.  move.l PLR1_Obj,a2
  733.  bra firefive
  734.  
  735. PLR2FIREBULLET:
  736.  move.l #%10011,d7
  737.  
  738.  move.w #256,d6
  739.  move.w #256,d5
  740.  
  741.  move.b MaxFrame,PLR2_GunFrame
  742.  move.l PLR2_Obj,a2
  743.  
  744. firefive:
  745.  
  746.  move.l PlayerShotData,a0
  747.  move.w #19,d1
  748. .findonefree
  749.  move.w 12(a0),d0
  750.  blt.s .foundonefree
  751.  adda.w #64,a0
  752.  dbra d1,.findonefree
  753.  
  754.  rts
  755.  
  756. .foundonefree
  757.  move.w B_Gravity+2(a5),shotgrav(a0)
  758.  move.b B_BounceOffWalls+3(a5),shotflags(a0)
  759.  move.b B_BounceOffFloors+3(a5),shotflags+1(a0)
  760.  
  761.  move.w bulyspd,d0
  762.  
  763.  cmp.w #20*128,d0
  764.  blt.s .okdownspd
  765.  move.w #20*128,d0
  766. .okdownspd:
  767.  
  768.  cmp.w #-20*128,d0
  769.  bgt.s .okupspd
  770.  move.w #-20*128,d0
  771. .okupspd:
  772.  
  773. ; add.w G_InitialYVel(a6),d0
  774.  
  775.  move.w d0,bulyspd
  776.  
  777.  move.l #ObjRotated,a2
  778.  move.b BULTYPE+1,shotsize(a0)
  779.  move.b B_DamageToTarget+3(a5),shotpower(a0)
  780.  
  781.  move.l ObjectPoints,a1
  782.  move.w (a0),d1
  783.  lea (a1,d1.w*8),a1
  784.  move.w tempxoff,(a1)
  785.  move.w tempzoff,4(a1)
  786.  move.w tempxdir,d0
  787.  ext.l d0
  788.  
  789.  move.w BulletSpd,d1
  790.  asl.l d1,d0
  791.  move.l d0,shotxvel(a0)
  792.  move.w tempzdir,d0
  793.  ext.l d0
  794.  asl.l d1,d0
  795.  move.b #2,16(a0)
  796.  move.l d0,shotzvel(a0)
  797.  move.w bulyspd,shotyvel(a0)
  798.  move.b tempStoodInTop,ObjInTop(a0)
  799.  move.w #0,shotlife(a0)
  800.  move.l d7,EnemyFlags(a0)
  801.  move.l tempRoompt,a2
  802.  move.w (a2),12(a0)
  803.  move.l tempyoff,d0
  804.  add.l #20*128,d0
  805.  move.l d0,accypos(a0)
  806.  st worry(a0)
  807.  asr.l #7,d0
  808.  move.w d0,4(a0)
  809.  
  810.  rts
  811.  
  812. PLR1HITINSTANT:
  813.  
  814. ; Just blow it up.
  815.  
  816.  move.l PlayerShotData,a0
  817.  move.w #19,d1
  818. .findonefree
  819.  move.w 12(a0),d2
  820.  blt.s .foundonefree
  821.  adda.w #64,a0
  822.  dbra d1,.findonefree
  823.  
  824.  rts
  825.  
  826. .foundonefree:
  827.  
  828.  move.b #2,16(a0)
  829.  move.l ObjectPoints,a1
  830.  move.w (a0),d2
  831.  move.l (a1,d0.w*8),(a1,d2.w*8)
  832.  move.l 4(a1,d0.w*8),4(a1,d2.w*8)
  833.  move.b #1,shotstatus(a0)
  834.  move.w #0,shotgrav(a0)
  835.  move.b BULTYPE+1,shotsize(a0)
  836.  move.b #0,shotanim(a0)
  837.  
  838.  move.w 4(a4),d1
  839.  ext.l d1
  840.  asl.l #7,d1
  841.  move.l d1,accypos(a0)
  842.  move.w 12(a4),12(a0)
  843.  st worry(a0)
  844.  move.w 4(a4),4(a0)
  845.  
  846.  move.w B_DamageToTarget+2(a5),d0
  847.  add.b d0,damagetaken(a4)
  848.  
  849.  move.w tempxdir,d1
  850.  ext.l d1
  851.  asl.l #3,d1
  852.  swap d1
  853.  move.w d1,ImpactX(a4)
  854.  move.w tempzdir,d1
  855.  ext.l d1
  856.  asl.l #3,d1
  857.  swap d1
  858.  move.w d1,ImpactZ(a4)
  859.  
  860.  rts
  861.  
  862. PLR1MISSINSTANT: 
  863.  
  864.  move.w PLR1_xoff,oldx
  865.  move.w PLR1_zoff,oldz
  866.  move.l PLR1_yoff,d1
  867.  add.l #20*128,d1
  868.  move.l d1,oldy
  869.  
  870.  move.w (a4),d0
  871.  move.l ObjectPoints,a1
  872.  move.w (a1,d0.w*8),d2
  873.  sub.w oldx,d2
  874.  asr.w #1,d2
  875.  add.w oldx,d2
  876.  move.w d2,newx
  877.  move.w 4(a1,d0.w*8),d2
  878.  sub.w oldz,d2
  879.  asr.w #1,d2
  880.  add.w oldz,d2
  881.  move.w d2,newz
  882.  
  883.  move.w 4(a0),d2
  884.  ext.l d2
  885.  asl.l #7,d2
  886.  move.l d2,newy
  887.  
  888.  st exitfirst
  889.  clr.b wallbounce
  890.  move.w #0,extlen
  891.  move.b #$ff,awayfromwall
  892.  move.w #%0000010000000000,wallflags
  893.  move.l #0,StepUpVal
  894.  move.l #$1000000,StepDownVal
  895.  move.l #0,thingheight
  896.  move.l PLR1_Roompt,objroom
  897.  movem.l d0-d7/a0-a6,-(a7)
  898.  
  899. .again:
  900.  jsr MoveObject
  901.  tst.b hitwall
  902.  bne.s .nofurther
  903.  move.w newx,d1
  904.  sub.w oldx,d1
  905.  add.w d1,oldx
  906.  add.w d1,newx
  907.  move.w newz,d1
  908.  sub.w oldz,d1
  909.  add.w d1,oldz
  910.  add.w d1,newz
  911.  move.l newy,d1
  912.  sub.l oldy,d1
  913.  add.l d1,oldy
  914.  add.l d1,newy
  915.  bra .again
  916.  
  917. .nofurther:
  918.  
  919.  movem.l (a7)+,d0-d7/a0-a6
  920.  
  921.  move.l PlayerShotData,a0
  922.  move.w #19,d1
  923. .findonefree2
  924.  move.w 12(a0),d2
  925.  blt.s .foundonefree2
  926.  adda.w #64,a0
  927.  dbra d1,.findonefree2
  928.  
  929.  rts
  930.  
  931. .foundonefree2:
  932.  
  933.  move.b #2,16(a0)
  934.  move.l ObjectPoints,a1
  935.  move.w (a0),d2
  936.  move.w newx,(a1,d2.w*8)
  937.  move.w newz,4(a1,d2.w*8)
  938.  move.b #1,shotstatus(a0)
  939.  move.w #0,shotgrav(a0)
  940.  move.b BULTYPE+1,shotsize(a0)
  941.  move.b #0,shotanim(a0)
  942.  
  943.  move.l objroom,a1
  944.  move.w (a1),12(a0)
  945.  st worry(a0)
  946.  move.l newy,d1
  947.  move.l d1,accypos(a0)
  948.  asr.l #7,d1
  949.  move.w d1,4(a0)
  950.  
  951.  rts
  952.  
  953.  
  954. PLR2HITINSTANT:
  955.  
  956. ; Just blow it up.
  957.  
  958.  move.l PlayerShotData,a0
  959.  move.w #19,d1
  960. .findonefree
  961.  move.w 12(a0),d2
  962.  blt.s .foundonefree
  963.  adda.w #64,a0
  964.  dbra d1,.findonefree
  965.  
  966.  rts
  967.  
  968. .foundonefree:
  969.  
  970.  move.b #2,16(a0)
  971.  move.l ObjectPoints,a1
  972.  move.w (a0),d2
  973.  move.l (a1,d0.w*8),(a1,d2.w*8)
  974.  move.l 4(a1,d0.w*8),4(a1,d2.w*8)
  975.  move.b #1,shotstatus(a0)
  976.  move.w #0,shotgrav(a0)
  977.  move.b BULTYPE+1,shotsize(a0)
  978.  move.b #0,shotanim(a0)
  979.  
  980.  move.w 4(a4),d1
  981.  ext.l d1
  982.  asl.l #7,d1
  983.  move.l d1,accypos(a0)
  984.  move.w 12(a4),12(a0)
  985.  st worry(a0)
  986.  move.w 4(a4),4(a0)
  987.  
  988.  move.w B_DamageToTarget+2(a5),d0
  989.  add.b d0,damagetaken(a4)
  990.  
  991.  move.w tempxdir,d1
  992.  ext.l d1
  993.  asl.l #3,d1
  994.  swap d1
  995.  move.w d1,ImpactX(a4)
  996.  move.w tempzdir,d1
  997.  ext.l d1
  998.  asl.l #3,d1
  999.  swap d1
  1000.  move.w d1,ImpactZ(a4)
  1001.  
  1002.  rts
  1003.  
  1004. PLR2MISSINSTANT: 
  1005.  
  1006.  move.w PLR2_xoff,oldx
  1007.  move.w PLR2_zoff,oldz
  1008.  move.l PLR2_yoff,d1
  1009.  add.l #20*128,d1
  1010.  move.l d1,oldy
  1011.  
  1012.  move.w (a4),d0
  1013.  move.l ObjectPoints,a1
  1014.  move.w (a1,d0.w*8),d2
  1015.  sub.w oldx,d2
  1016.  asr.w #1,d2
  1017.  add.w oldx,d2
  1018.  move.w d2,newx
  1019.  move.w 4(a1,d0.w*8),d2
  1020.  sub.w oldz,d2
  1021.  asr.w #1,d2
  1022.  add.w oldz,d2
  1023.  move.w d2,newz
  1024.  
  1025.  move.w 4(a0),d2
  1026.  ext.l d2
  1027.  asl.l #7,d2
  1028.  move.l d2,newy
  1029.  
  1030.  st exitfirst
  1031.  clr.b wallbounce
  1032.  move.w #0,extlen
  1033.  move.b #$ff,awayfromwall
  1034.  move.w #%0000010000000000,wallflags
  1035.  move.l #0,StepUpVal
  1036.  move.l #$1000000,StepDownVal
  1037.  move.l #0,thingheight
  1038.  move.l PLR2_Roompt,objroom
  1039.  movem.l d0-d7/a0-a6,-(a7)
  1040.  
  1041. .again:
  1042.  jsr MoveObject
  1043.  tst.b hitwall
  1044.  bne.s .nofurther
  1045.  move.w newx,d1
  1046.  sub.w oldx,d1
  1047.  add.w d1,oldx
  1048.  add.w d1,newx
  1049.  move.w newz,d1
  1050.  sub.w oldz,d1
  1051.  add.w d1,oldz
  1052.  add.w d1,newz
  1053.  move.l newy,d1
  1054.  sub.l oldy,d1
  1055.  add.l d1,oldy
  1056.  add.l d1,newy
  1057.  bra .again
  1058.  
  1059. .nofurther:
  1060.  
  1061.  movem.l (a7)+,d0-d7/a0-a6
  1062.  
  1063.  move.l PlayerShotData,a0
  1064.  move.w #19,d1
  1065. .findonefree2
  1066.  move.w 12(a0),d2
  1067.  blt.s .foundonefree2
  1068.  adda.w #64,a0
  1069.  dbra d1,.findonefree2
  1070.  
  1071.  rts
  1072.  
  1073. .foundonefree2:
  1074.  
  1075.  move.b #2,16(a0)
  1076.  move.l ObjectPoints,a1
  1077.  move.w (a0),d2
  1078.  move.w newx,(a1,d2.w*8)
  1079.  move.w newz,4(a1,d2.w*8)
  1080.  move.b #1,shotstatus(a0)
  1081.  move.w #0,shotgrav(a0)
  1082.  move.b BULTYPE+1,shotsize(a0)
  1083.  move.b #0,shotanim(a0)
  1084.  
  1085.  move.l objroom,a1
  1086.  move.w (a1),12(a0)
  1087.  st worry(a0)
  1088.  move.l newy,d1
  1089.  move.l d1,accypos(a0)
  1090.  asr.l #7,d1
  1091.  move.w d1,4(a0)
  1092.  
  1093.  rts
  1094.